package com.okex.demo;

import com.okex.demo.service.AccountService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 欧易(OKX)数据展示应用
 * 
 * 注意：我们不再使用@EnableScheduling注解
 * 改为使用事件驱动的DataPollingService替代传统的@Scheduled任务
 */
@SpringBootApplication
@EnableScheduling
public class OkexWebsocketDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(OkexWebsocketDemoApplication.class, args);
    }
    
    /**
     * 应用启动后初始化数据
     */
    @Bean
    public CommandLineRunner initData(AccountService accountService) {
        return args -> {
            // 初始化默认账户数据
            accountService.initDefaultAccounts();
        };
    }
} 